from TurtleWorld import *
from math import *
 
world=TurtleWorld()
rob=Turtle()
rob.color = "grey"
rob.delay = 0.1

#----------------------------TRIANGLES----------------------------#

def equilateral_tri(t, size=100, rotate=0):
	for i in range(1):
            t.lt(rotate)
            t.fd(size)
            t.lt(120)
            t.fd(size)
            t.lt(120)
            t.fd(size)
            t.lt(120)
            t.rt(rotate)
    
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=100, height=100, angle=120, rotate=0):
	for i in range(1):
            t.lt(rotate)
            t.fd(width)
            t.rt(360-angle)
            t.fd(height)
            t.lt(180-angle)
            t.fd(width)
            t.rt(360-angle)
            t.fd(height)
            t.rt(rotate)

def rhom(t, size=100, angle=120, rotate=0):
	for i in range(1):
            t.lt(rotate)
            t.fd(size)
            t.rt(360-angle)
            t.fd(size)
            t.lt(180-angle)
            t.fd(size)
            t.rt(360-angle)
            t.fd(size)
            t.rt(rotate)
 

def rect(t, width=100, height=100, rotate=0):
	count = 1
        while count <= 4:
            t.lt(rotate)
            t.fd(width)
            t.lt()
            t.fd(height)
            t.lt()
            t.rt(rotate)
            count += 1

def square(t, size=100, rotate=0):
	for i in range(4):
            t.lt(rotate)
            t.fd(size)
            t.lt(90)
            t.rt(rotate)
 
#------------------------------MOVEMENT---------------------------#

def line(t, x=100, y=100):
        dist = sqrt(x**2 + y**2)
        angle = degrees(atan(y/float(x)))
        t.lt(angle)
        t.fd(dist)

        print "Line to a point X:", x, "over and Y:", y, "up"
    
def move(t, x, y):
        t.pu()
        dist = sqrt(x**2 + y**2)
        angle = degrees(atan(y/float(x)))
        t.lt(angle)
        t.fd(dist)
        t.pd
        
        print "Move without marking to a point X:", x, "over and Y:", y, "up"
 	
#------------------------------OTHER SHAPES------------------------#
"""
Build any other shape functions you want.
Some Ideas:
	Right Triangles (sss, sas, etc)
	Arbitrary Triangles
	Circle
	Arcs
	Go Wild!
	
Bonus for working or challenging functions...no penalty for trying something
"""

def hexagon(t, side=6, rotate=0):
    count = 1
    while count <= 6:
        t.lt(rotate)
        t.fd(side)
        t.lt(60)
        t.rt(rotate)
        count += 1

def pentagon(t, side=100, angle=120, rotate=0):
    count = 1
    while count <= 5:
        t.lt(rotate)
        t.fd(side)
        t.lt(360/5)
        t.rt(rotate)
        count += 1

def heptagon(t, side=100, angle=120, rotate=0):
    count = 1
    while count <= 7:
        t.lt(rotate)
        t.fd(side)
        t.lt(360/7)
        t.rt(rotate)
        count += 1

def trapazoid(t, top=100, bottom=150, side=50, angle=120, rotate=0):
        t.lt(rotate)
        t.lt(120)
        t.fd(side)
        t.lt(60)
        t.fd(top)
        t.lt(60)
        t.fd(side)
        t.lt(120)
        t.fd(bottom)
        t.rt(rotate)


#------------------------------TEST-------------------------------#

move(rob, 20, -30)

 


wait_for_user()